<?php
/**
 * 
 * IndexAction.class.php (前台首页)
 *
 * @package      	szflame
 * @author          
 * @copyright     	
 * @license         
 * @version        	szflame企业网站管理系统 v2012.12.12 2011-03-01 198616.com $
 */
if(!defined("szflame")) exit("Access Denied");
class IndexAction extends BaseAction
{
    public function index()
    { 
    	$T = F('config_'.LANG_NAME,'', APP_PATH.'Tpl/Home/'.$this->sysConfig['DEFAULT_THEME'].'/');
    	//$cat = $this->Categorys[$T['homeid']];
		foreach($this->categorys as $cat){
			if($cat['parentid'] == 0 && $cat['status'] == 1 && $cat['ismenu'] > 1){
				break;
			}
		}
    	$this->seo_title = $cat['title'];
    	$this->seo_keywords = $cat['keywords'];
    	$this->seo_description = $cat['description'];
    	$Categorys = $this->Categorys;
    	
		$filename = TMPL_PATH.'Home/'.$this->sysConfig['DEFAULT_THEME'].'/codeIndex.php';
		if(file_exists($filename)){
			include $filename;
		}   
    	$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    	$userAgent = userAgent($ua);    	
    	
$map['lang'] = LANG_ID;
$map['varname'] = 'homelodding';
$homelodding = M("Config")->where($map)->find();

    	if($_SERVER['REQUEST_URI'] == '/' && $userAgent != 'mobile' && !empty($homelodding['value'])){
    		$template = 'landing';
    	}else{
    		$template = 'index';
    	}
        $this->display($template);
    }
	public function landing()
    { 
    	$T = F('config_'.LANG_NAME,'', APP_PATH.'Tpl/Home/'.$this->sysConfig['DEFAULT_THEME'].'/');
    	$cat = $this->Categorys[$T['homeid']];
    	$this->seo_title = $cat['title'];
    	$this->seo_keywords = $cat['keywords'];
    	$this->seo_description = $cat['description'];
        $this->display();
    } 
}
?>